package com.example.administrator.liveapp.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Administrator on 2017/5/26 0026.
 */

public class CommentViewPagerAdapter extends PagerAdapter {
    public List<View> viewContainter;
    public CommentViewPagerAdapter(List<View> viewContainter){
        this.viewContainter = viewContainter;
    }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(viewContainter.get(position));
        return viewContainter.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(viewContainter.get(position));
    }

    @Override
    public int getItemPosition(Object object) {
        return super.getItemPosition(object);
    }

    @Override
    public int getCount() {
        return viewContainter.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }
}
